package com.daxue.localserver.config;

import com.daxue.localserver.interceptor.LogGrpcInterceptor;
import com.daxue.localserver.service.LockServcieTest;
import io.grpc.ServerInterceptor;
import net.devh.boot.grpc.server.interceptor.GrpcGlobalServerInterceptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author daxue0929
 * @date 2022/08/31
 **/

@Configuration(proxyBeanMethods = false)
public class GlobalInterceptorConfiguration {

    @GrpcGlobalServerInterceptor
    ServerInterceptor logServerInterceptor() {
        return new LogGrpcInterceptor();
    }


    @Value("${daxue}")
    public String test;

    @Bean
    LockServcieTest lockServcieTest() {
        System.out.println("test: " + test);
        return new LockServcieTest();
    }


}
